/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.tags;

import alcatelparser.modules.BuilderFactory;
import alcatelparser.modules.I;

/**
 *
 * @author geniuz
 */
public class CauseTag extends DefaultParserTag
{

    public CauseTag()
    {
    }

    public final void parseTag(int ai[], int i)
    {
        _array = ai;
        _startParsePosition = i;
        setStandartLength(ai, i);
        /*
        if(isFullForm())
        {
            BuilderFactory.getBuilder().writeTagContent(3, 0, getTagPropertiesValue(I.I(1901)), getTagIdentifyContent(i, i + 1));
            parseCauseValue(i + 2);
            parseLocationValue(i + 2 + 4);
        } else
        {
            if(isTagChecked(I.I(1895)))
                parseCauseValue(i + 2);
            if(isTagChecked(I.I(1911)))
                parseLocationValue(i + 2 + 4);
        }*/
    }

    private void parseLocationValue(int i)
    {
        int j = _array[i + 2];
        if(isFullForm())
        {
            String s = (new StringBuilder()).append(getTagIdentifyContent(i, i + 1)).append(toHex(j)).append(I.I(5425)).append(getTagPropertiesValue((new StringBuilder()).append(I.I(6696)).append(j).toString())).toString();
            BuilderFactory.getBuilder().writeTagContent(4, 0, getTagPropertiesValue(I.I(1925)), s);
        } else
        {
            String s1 = getReducedTagPropertiesValue(I.I(1925));
            if(isFieldsDecoding())
                BuilderFactory.getBuilder().writeTagContent(1, 0, s1, getReducedTagPropertiesValue((new StringBuilder()).append(I.I(6696)).append(j).toString()));
            else
                BuilderFactory.getBuilder().writeTagContent(1, 0, s1, toHex(j));
        }
    }

    private void parseCauseValue(int i)
    {
        int j = _array[i + 2];
        int k = _array[i + 3];
        if(isFullForm())
        {
            String s = (new StringBuilder()).append(getTagIdentifyContent(i, i + 1)).append(toHex(j)).append(toHex(k)).append(I.I(5425)).append(getTagPropertiesValue((new StringBuilder()).append(I.I(6660)).append(k).toString())).toString();
            BuilderFactory.getBuilder().writeTagContent(4, 0, getTagPropertiesValue(I.I(6680)), s);
        } else
        {
            String s1 = getReducedTagPropertiesValue(I.I(1901));
            if(isFieldsDecoding())
                BuilderFactory.getBuilder().writeTagContent(1, 0, s1, getReducedTagPropertiesValue((new StringBuilder()).append(I.I(6660)).append(k).toString()));
            else
                BuilderFactory.getBuilder().writeTagContent(1, 0, s1, (new StringBuilder()).append(toHex(j)).append(toHex(k)).toString());
        }
    }

    public final String getParseIdentityTag()
    {
        return I.I(6657);
    }
}
